﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Practices.Unity;

namespace EasyInvoice.ApplicationContext
{
    class ApplicationContainerFactory
    {
        private static volatile ApplicationContainerFactory instance;
        private static object syncRoot = new Object();
        IUnityContainer container = null;

        private ApplicationContainerFactory()
        {
            container = new UnityContainer();
        }

        public IUnityContainer Container
        {
            get { return container; }
        }

        public static ApplicationContainerFactory Instance
        {
            get
            {
                if (instance == null)
                {
                    lock (syncRoot)
                    {
                        if (instance == null)
                            instance = new ApplicationContainerFactory();
                    }
                }

                return instance;
            }
        }
    }
}
